<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>ConvertCoordinateX</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">ConvertCoordinateX()</font></b></p>
<p><b>语法</b></p><blockquote>

Result.d = <font color="#3A3966"><b>ConvertCoordinateX</b></font>(x.d, y.d [, Source, Target])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Convert a point from one coordinate system to another in the vector drawing output. 
This function returns the X coordinate of the conversion. The Y coordinate can be 
retrieved with the <a href="convertcoordinatey.html">ConvertCoordinateY()</a> function. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>x.d, y.d</i></td>
<td width="90%"> 
 
Specifies the coordinates of the point to convert in terms of the source 
coordinate system. 

 

</td></tr>
<tr><td><i>Source, Target (optional)</i></td>
<td> 
 
Specifies the source and target coordinates for the conversion. Each can be one of these values: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Coordinate_Device</font>: The coordinate system of the output device
  <font color="#924B72">#PB_Coordinate_Output</font>: The coordinate system as it was created with the drawing output function
  <font color="#924B72">#PB_Coordinate_User</font>  : The coordinate system for points in the drawing path
  <font color="#924B72">#PB_Coordinate_Source</font>: The coordinate system for the vector drawing source
</font></pre>

The default conversion is from <font color="#924B72">#PB_Coordinate_User</font> to <font color="#924B72">#PB_Coordinate_Output</font>. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns the X coordinate of the point in the target coordinate system. 

 

</blockquote><p><b>备注</b></p><blockquote>



See the <a href="index.html">vectordrawing overview</a> for an introduction to the different 
coordinate systems. 

 

</blockquote><p><b>示例</b></p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; This example draws a dot at the mouse location even in a modified coordinate system</font>
  <font color="#3A3966">; by mapping the coordinates from the device system (pixels) to the user system (points)</font>
  <font color="#3A3966">;</font>
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 400, 200, "VectorDrawing", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#3A3966">    CanvasGadget</font>(0, 0, 0, 400, 200)
    
    <b><font color="#3A3966">Repeat</font></b>
      Event =<font color="#3A3966"> WaitWindowEvent</font>()
      
      <b><font color="#3A3966">If</font></b> Event = <font color="#924B72">#PB_Event_Gadget</font> <b><font color="#3A3966">And</font></b> <font color="#3A3966">EventGadget</font>() = 0 <b><font color="#3A3966">And</font></b> <font color="#3A3966">EventType</font>() = <font color="#924B72">#PB_EventType_LeftButtonDown</font>
        
        <b><font color="#3A3966">If</font></b> <font color="#3A3966">StartVectorDrawing</font>(<font color="#3A3966">CanvasVectorOutput</font>(0, <font color="#924B72">#PB_Unit_Point</font>))
<font color="#3A3966">          RotateCoordinates</font>(0, 0, 30)
          
          CanvasX =<font color="#3A3966"> GetGadgetAttribute</font>(0, <font color="#924B72">#PB_Canvas_MouseX</font>)
          CanvasY =<font color="#3A3966"> GetGadgetAttribute</font>(0, <font color="#924B72">#PB_Canvas_MouseY</font>)
          
          DrawingX =<font color="#3A3966"> ConvertCoordinateX</font>(CanvasX, CanvasY, <font color="#924B72">#PB_Coordinate_Device</font>, <font color="#924B72">#PB_Coordinate_User</font>)
          DrawingY =<font color="#3A3966"> ConvertCoordinateY</font>(CanvasX, CanvasY, <font color="#924B72">#PB_Coordinate_Device</font>, <font color="#924B72">#PB_Coordinate_User</font>)
          
<font color="#3A3966">          AddPathCircle</font>(DrawingX, DrawingY, 10)
<font color="#3A3966">          VectorSourceColor</font>(<font color="#3A3966">RGBA</font>(<font color="#3A3966">Random</font>(255),<font color="#3A3966"> Random</font>(255),<font color="#3A3966"> Random</font>(255), 255))
<font color="#3A3966">          FillPath</font>()
        
<font color="#3A3966">          StopVectorDrawing</font>()
        <b><font color="#3A3966">EndIf</font></b>
        
      <b><font color="#3A3966">EndIf</font></b>
      
    <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="resetcoordinates.html">ResetCoordinates()</a>, <a href="translatecoordinates.html">TranslateCoordinates()</a>, <a href="scalecoordinates.html">ScaleCoordinates()</a>, <a href="rotatecoordinates.html">RotateCoordinates()</a>, 
<a href="skewcoordinates.html">SkewCoordinates()</a>, <a href="flipcoordinatesx.html">FlipCoordinatesX()</a>, <a href="flipcoordinatesy.html">FlipCoordinatesY()</a>, <a href="convertcoordinatey.html">ConvertCoordinateY()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=closepath.html>ClosePath()</a> - <a href="index.html">VectorDrawing Index</a> - <a href="convertcoordinatey.html">ConvertCoordinateY()</a> -&gt;<br><br>

</body></html>